home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club (Business) 1997 July / Software of the Month Club - Business (Volume 239) (July 1997).iso / pc / code / a.dxr / 00005_A_Enviro Handlers.ls < prev    next >
Encoding:
Text File  |  1996-02-15  |  9.1 KB  |  296 lines

  1. global cNullCast, gObjects, gEnvironmentSound, gCursorlist, gKeyRef, cNUllCharmovie
  2.  
  3. on DoTest
  4. end
  5.  
  6. on doOpenJuliapanel
  7.   set the movieRate of sprite 36 to 0
  8.   updateStage()
  9.   OpenCloseADDobj(#Juliapanel)
  10. end
  11.  
  12. on CalcTransToA19
  13.   if (getaProp(getaProp(gStates, #Conditions), #Trailer) = #true) and voidp(getaProp(getaProp(gStates, #BeenThere), #A19B)) then
  14.     return #A19B
  15.   else
  16.     return #A19
  17.   end if
  18. end
  19.  
  20. on exitWindowShade
  21.   if getaProp(getaProp(gObjects, #Windowshade), #State) = #open then
  22.     OpenClose(#Windowshade)
  23.   end if
  24.   DelClockSolved()
  25. end
  26.  
  27. on ExitJuliaPanel
  28.   global sQTCharSprite
  29.   if getaProp(getaProp(gObjects, #Juliapanel), #State) = #open then
  30.     OpenCloseADDobj(#Juliapanel)
  31.     set the movieRate of sprite sQTCharSprite to 0
  32.   end if
  33.   DoRadioChannel()
  34. end
  35.  
  36. on DoJuliaPanel
  37.   set OBj to getaProp(gObjects, #Juliapanel)
  38.   if getaProp(OBj, #State) = #open then
  39.     set the loop of cast cNUllCharmovie to 0
  40.     set the loc of sprite getaProp(getaProp(gObjects, #JuliaPaint), #SpriteNum) to point(-2000, -2000)
  41.     updateStage()
  42.     set the movieRate of sprite getaProp(getaProp(gObjects, #JuliaPaint), #SpriteNum) to 0
  43.   else
  44.     set the loop of cast cNUllCharmovie to 1
  45.     DoCharacterMovie(#JuliaPaint)
  46.   end if
  47. end
  48.  
  49. on EnterClockDoor
  50.   DoRadioChannel()
  51.   if getaProp(getaProp(gObjects, #ClockDrawer), #solved) = #true then
  52.     AddObjects([#ClockAnimreg])
  53.   else
  54.     AddObjects([#ClockAnimChaos])
  55.   end if
  56. end
  57.  
  58. on ExitClockDoor
  59.   if getaProp(getaProp(gObjects, #ClockDrawer), #solved) = #true then
  60.     DelObjects([#ClockAnimreg])
  61.   else
  62.     DelObjects([#ClockAnimChaos])
  63.   end if
  64. end
  65.  
  66. on ExitSinKnob
  67.   if getaProp(getaProp(gObjects, #SinKnob), #State) = #open then
  68.     OpenCloseADDobj(#SinKnob)
  69.   end if
  70. end
  71.  
  72. on DoradioPower
  73.   set OBj to getaProp(gObjects, #RadioPower)
  74.   if getaProp(OBj, #State) = #on then
  75.     DoRadioChannel()
  76.   else
  77.     DoRadioChannel()
  78.     MakeDynamic(#RadioPower, #AmbientSound, #NULL)
  79.   end if
  80.   MakeDynamic(#RadioPower, #DisplayState, getaProp(OBj, #State))
  81. end
  82.  
  83. on testmetimer
  84.   set a to the timer
  85.   playSound("A3DJ.aif", #File, 1)
  86.   put the timer - a
  87. end
  88.  
  89. on DoRadioChannel
  90.   if getaProp(gStates, #EnviroLetter) = "a" then
  91.     set power to getaProp(gObjects, #RadioPower)
  92.     set OBj to getaProp(gObjects, #RadioChannel)
  93.     if voidp(getaProp(OBj, #IntroPlay)) then
  94.       MakeDynamic(#RadioChannel, #IntroPlay, playSound("A3DJ.aif", #File))
  95.       Startthetimer(1225, "DoRadioChannel")
  96.     else
  97.       set asound to getaProp(getaProp(OBj, #AmbientSound), getaProp(OBj, #State))
  98.       set IntroSound to CheckPlayingintroSound(OBj)
  99.       if getaProp(power, #State) = #on then
  100.         if IntroSound = #done then
  101.           if getOne([#A09, #A13], gKeyRef) = 0 then
  102.             playSound(asound, #AmbientLoop)
  103.             MakeDynamic(#RadioChannel, #DisplayState, getaProp(OBj, #State))
  104.           else
  105.             Startthetimer(60, "DoRadioChannel")
  106.           end if
  107.         end if
  108.       else
  109.         if getaProp(power, #State) <> #on then
  110.           if IntroSound = #done then
  111.             stopsound(asound)
  112.           else
  113.             stopsound("A3DJ.aif")
  114.             setaProp(OBj, #IntroPlay, #done)
  115.           end if
  116.         end if
  117.       end if
  118.     end if
  119.   end if
  120. end
  121.  
  122. on CheckPlayingintroSound OBj
  123.   set Channel to getaProp(OBj, #IntroPlay)
  124.   if Channel = #done then
  125.     return #done
  126.   else
  127.     if soundBusy(Channel) then
  128.       if getaProp(getaProp(gSoundchannels, Channel), #name) = "A3DJ.aif" then
  129.         stopsound(Channel)
  130.         setaProp(OBj, #IntroPlay, #done)
  131.         return #done
  132.       end if
  133.     else
  134.       setaProp(OBj, #IntroPlay, #done)
  135.       return #done
  136.     end if
  137.   end if
  138. end
  139.  
  140. on DoclockMag MagNum
  141.   set OBj to getaProp(gObjects, #ClockDrawer)
  142.   set Childref to getAt(getaProp(OBj, #Children), MagNum)
  143.   set Child to getaProp(gObjects, Childref)
  144.   MakeDynamic(Childref, #loc, getaProp(Child, #loc))
  145.   if inside(getaProp(Child, #loc), getaProp(OBj, #TestRect)) then
  146.     setAt(getaProp(OBj, #MagsOut), MagNum, 0)
  147.   else
  148.     setAt(getaProp(OBj, #MagsOut), MagNum, 1)
  149.   end if
  150.   if getOne(getaProp(OBj, #MagsOut), 0) > 0 then
  151.     MakeDynamic(#ClockDrawer, #solved, #false)
  152.     MakeDynamic(#TVPhoneOBJ, #solved, #false)
  153.     MakeDynamic(#JuliaPaint, #solved, #false)
  154.     stopsound("A11tik.aif")
  155.     playSound("A11clock.aif", #cast)
  156.   else
  157.     MakeDynamic(#ClockDrawer, #solved, #true)
  158.     stopsound("A11clock.aif")
  159.     playSound("A10ckfix.aif", #cast, 1)
  160.     playSound("A11tik.aif", #cast)
  161.   end if
  162. end
  163.  
  164. on EnterA13
  165.   SetTimeDail()
  166. end
  167.  
  168. on DoaDial OBJref
  169.   set OBj to getaProp(gObjects, OBJref)
  170.   set thehots to getaProp(OBj, #thehotrects)
  171.   set CurNum to getaProp(OBj, #time)
  172.   set lastrect to getaProp(OBj, #DisplayState)
  173.   repeat while the mouseDown
  174.     set currect to InahotRect(thehots, the mouseH, the mouseV)
  175.     if (currect <> #empty) and (lastrect <> currect) then
  176.       set the castNum of sprite getaProp(OBj, #SpriteNum) to getaProp(getaProp(OBj, #cast), currect)
  177.       set the loc of sprite getaProp(OBj, #SpriteNum) to getAt(getaProp(OBj, #thelocs), currect)
  178.       updateStage()
  179.       if (currect > lastrect) or ((lastrect = 16) and (currect = 1)) then
  180.         set CurNum to CurNum + 1
  181.       else
  182.         if (currect < lastrect) or ((lastrect = 1) and (currect = 16)) then
  183.           set CurNum to CurNum - 1
  184.         end if
  185.       end if
  186.       if CurNum > getaProp(OBj, #TimeVal) then
  187.         set CurNum to getaProp(OBj, #startTime)
  188.       end if
  189.       if CurNum < getaProp(OBj, #startTime) then
  190.         set CurNum to getaProp(OBj, #TimeVal)
  191.       end if
  192.       MakeDynamic(OBJref, #time, CurNum)
  193.       SetTimeDail()
  194.       set lastrect to currect
  195.     end if
  196.   end repeat
  197.   ResetHotRects(OBJref)
  198.   MakeDynamic(OBJref, #DisplayState, lastrect)
  199. end
  200.  
  201. on SetTimeDail
  202.   set Hour to getaProp(getaProp(gObjects, #JuliaDialHour), #time)
  203.   set min to getaProp(getaProp(gObjects, #JuliaDialMin), #time)
  204.   if Hour < 10 then
  205.     set Hour to string("0" & Hour)
  206.   end if
  207.   if min < 10 then
  208.     set min to string("0" & min)
  209.   end if
  210.   set theTime to Hour & ":" & min
  211.   set the text of cast getaProp(getaProp(getaProp(gObjects, #JuliaTime), #cast), #time) to theTime
  212. end
  213.  
  214. on CheckDailTime
  215.   set movObj to getaProp(gObjects, #JuliaPaint)
  216.   set the loc of sprite getaProp(getaProp(gObjects, #JuliaCircle2), #SpriteNum) to point(-2000, -2000)
  217.   if (the text of cast getaProp(getaProp(getaProp(gObjects, #JuliaTime), #cast), #time) = "02:59") and (getaProp(getaProp(gObjects, #ClockDrawer), #solved) = #true) then
  218.     MakeDynamic(#JuliaPaint, #DisplayState, #right)
  219.     set the castNum of sprite getaProp(getaProp(gObjects, #JuliaGreenBut), #SpriteNum) to getaProp(getaProp(getaProp(gObjects, #JuliaGreenBut), #cast), #down)
  220.     set the castNum of sprite getaProp(getaProp(gObjects, #JuliaRedBut), #SpriteNum) to getaProp(getaProp(getaProp(gObjects, #JuliaRedBut), #cast), #UP)
  221.     MakeDynamic(#JuliaPaint, #solved, #true)
  222.   else
  223.     MakeDynamic(#JuliaPaint, #DisplayState, #Wrong)
  224.     set the castNum of sprite getaProp(getaProp(gObjects, #JuliaGreenBut), #SpriteNum) to getaProp(getaProp(getaProp(gObjects, #JuliaGreenBut), #cast), #UP)
  225.     set the castNum of sprite getaProp(getaProp(gObjects, #JuliaRedBut), #SpriteNum) to getaProp(getaProp(getaProp(gObjects, #JuliaRedBut), #cast), #down)
  226.     MakeDynamic(#JuliaPaint, #solved, #false)
  227.     MakeDynamic(#TVPhoneOBJ, #solved, #false)
  228.   end if
  229.   DoCharacterMovie(#JuliaPaint)
  230.   repeat while the movieTime of sprite getaProp(movObj, #SpriteNum) < the stopTime of sprite getaProp(movObj, #SpriteNum)
  231.     CursorandUpdate()
  232.   end repeat
  233.   MakeDynamic(#JuliaPaint, #DisplayState, #Paint)
  234.   set the loc of sprite getaProp(movObj, #SpriteNum) to point(-2000, -2000)
  235.   set the loc of sprite getaProp(getaProp(gObjects, #JuliaCircle2), #SpriteNum) to getaProp(getaProp(gObjects, #JuliaCircle), #loc)
  236. end
  237.  
  238. on InahotRect Hotrects, H, V
  239.   set nHotr to count(Hotrects)
  240.   repeat with X = 1 to nHotr
  241.     if inside(point(H, V), getAt(Hotrects, X)) then
  242.       return X
  243.     end if
  244.   end repeat
  245.   return #empty
  246. end
  247.  
  248. on ResetHotRects OBJref
  249.   set OBj to getaProp(gObjects, OBJref)
  250.   set hotrectnum to integer(getaProp(OBj, #SpriteNum) & "01")
  251.   MakeDynamic(OBJref, #loc, the loc of sprite getaProp(OBj, #SpriteNum))
  252.   setAt(getaProp(OBj, #Hotrect), 1, the rect of sprite getaProp(OBj, #SpriteNum))
  253.   setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(OBj, #Hotrect), 1))
  254. end
  255.  
  256. on AddClocksolved
  257.   if getaProp(getaProp(gObjects, #ClockDrawer), #solved) = #false then
  258.     set asound to "A11clock.aif"
  259.     set Clocks to [#A06: [#Clock1], #A07: [#clock3], #A10: [#clock2]]
  260.     AddObjects(getaProp(Clocks, getaProp(gCurKeyList, #RefName)))
  261.   else
  262.     set asound to "A11tik.aif"
  263.   end if
  264.   if gKeyRef = #A06 then
  265.     stopsound(asound)
  266.   else
  267.     playSound(asound, #cast)
  268.   end if
  269. end
  270.  
  271. on DelClockSolved
  272.   if getaProp(getaProp(gObjects, #ClockDrawer), #solved) = #false then
  273.     set Clocks to [#A06: [#Clock1], #A07: [#clock3], #A10: [#clock2]]
  274.     DelObjects(getaProp(Clocks, getaProp(gCurKeyList, #RefName)))
  275.   end if
  276. end
  277.  
  278. on CalcHavePDA RefLoc
  279.   put RefLoc
  280.   if getaProp(getaProp(gObjects, #PDAOBJ), #Aquired) = #false then
  281.     set RefLoc to value("#" & RefLoc & "A")
  282.   else
  283.     set RefLoc to value("#" & RefLoc & "B")
  284.   end if
  285.   return RefLoc
  286. end
  287.  
  288. on PDAGrab
  289.   ReleaseUNVobject(#PDAOBJ)
  290. end
  291.  
  292. on ClearClocksound
  293.   AddClocksolved()
  294.   puppetSound(0)
  295. end
  296.